<?php
//if (isset($_SESSION['username'])) {
include_once 'header.php';
require_once("../conn.php");
require_once("../change_page.php");
require_once 'suggest.action.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv= "Content-Type" content= "text/html; charset=utf-8" charset= "utf-8 "/>
        <title>乐知家园</title>        
        <style type="text/css">
            <!--
            body,td,th {
                font-family: 微软雅黑;
                font-size: 14px;
                color: #000000;
            }

            .STYLE1 {color: #FFFFFF}
            -->
        </style></head>
    <?php    
    $data = getSuggestAnimation();
    ?>
    <body>
        <br/>
        <form action="animationSuggest.action.php?module=animationSuggest" method="post">
            <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#9999FF">
                <tr align="center">
                    <td align="left">
                        &nbsp;<input type="submit" value="保存" onclick="save()"/></td>
                </tr>
            </table>
            <br/>
            <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1">
                <tr align="center">
                    <td bgcolor="#666666" width="5%"><span class="STYLE1">序号</span></td>
                    <td bgcolor="#666666" width="5%"><span class="STYLE1">编号</span></td>
                    <td bgcolor="#666666" width="10%"><span class="STYLE1">名称</span></td>
                    <td bgcolor="#666666" width="25%"><span class="STYLE1">URL</span></td>
                    <td bgcolor="#666666" width="5%"><span class="STYLE1">类型</span></td>
                    <td bgcolor="#666666" width="10%"><span class="STYLE1">月份</span></td>
                    <td bgcolor="#666666" width="5%"><span class="STYLE1">排序</span></td>
                </tr>
                <?php
                $num = 0;
                if ($data != false && count($data) > 0) {
                    foreach ($data as $row) {
                        if (!isset($row['num'])) {
                            $row['num'] = $num + 1;
                        }
                        ?>
                        <tr>
                            <td bgcolor="#FFFFFF">&nbsp;<?php echo++$num; ?></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="code[]" value="<?php echo $row['code']; ?>" style="width:60px" /></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="name[]" value="<?php echo $row['name']; ?>"  style="width:100px"/>&nbsp;<input type="hidden" name="num[]" value="<?php echo $num; ?>" />&nbsp;</td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="url[]" value="<?php echo $row['url']; ?>"  style="width:260px"/></td>
                            <!--<td bgcolor="#FFFFFF">&nbsp;<input type="text" name="type[]" value="< ?php echo $row['type']; ?>"  style="width:60px"/></td>-->
                            <td bgcolor="#FFFFFF">
                                <select name="type[]">
                                    <option value="1" <?php if ($row['type'] == 1) { ?>selected<?php } ?>>故事</option>
                                    <option value="2" <?php if ($row['type'] == 2) { ?>selected<?php } ?>>成语</option>
                                    <option value="3" <?php if ($row['type'] == 3) { ?>selected<?php } ?>>寓言</option>
                                    <option value="4" <?php if ($row['type'] == 4) { ?>selected<?php } ?>>童话</option>
                                    <option value="5" <?php if ($row['type'] == 5) { ?>selected<?php } ?>>儿歌</option>
                                    <option value="6" <?php if ($row['type'] == 6) { ?>selected<?php } ?>>诗词</option>
                                    <option value="7" <?php if ($row['type'] == 7) { ?>selected<?php } ?>>汉字</option>
                                </select></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="month[]" value="<?php echo $row['month']; ?>"  style="width:100px"/></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="num[]" value="<?php echo $row['num']; ?>"  style="width:30px"/></td>
                        </tr>
                        <?php
                    }
                }
                if ($num < 20) {
                    for ($i = $num; $i < 20; $i++) {
                        ?>
                        <tr>
                            <td bgcolor="#FFFFFF">&nbsp;<?php echo++$num; ?></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="code[]" value=""  style="width:60px"/></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="name[]" value=""  style="width:100px"/><input type="hidden" name="num[]" value="<?php echo $num; ?>" /></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="url[]" value=""  style="width:260px"/></td>                            
                            <td bgcolor="#FFFFFF">
                                <select name="type[]">
                                    <option value="1">故事</option>
                                    <option value="2">成语</option>
                                    <option value="3">寓言</option>
                                    <option value="4">童话</option>
                                    <option value="5">儿歌</option>
                                    <option value="6">诗词</option>
                                    <option value="7">汉字</option>
                                </select></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="month[]" value=""  style="width:100px"/></td>
                            <td bgcolor="#FFFFFF">&nbsp;<input type="text" name="num[]" value=""  style="width:30px"/></td>
                            
                        </tr>
                        <?php
                    }
                }
                ?>
            </table>
        </form>
    </body>
</html>
<?php
include_once '../footer.php';
?>